home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / NetworkManager < prev    next >
Text File  |  2008-10-20  |  1KB  |  76 lines

  1. #! /bin/sh
  2. #
  3. # NetworkManager    NetworkManager daemon
  4. #                Daemon for automatically switching network 
  5. #                connections to the best available connection.
  6. #                This file should be placed in /etc/init.d.
  7. #
  8. # Authors:    <j@bootlab.org>
  9. #            Mark Roach <mrroach@okmaybe.com>
  10. #            Thom May <thom@debian.org>
  11. #
  12. # Version:    @(#)skeleton  2.85-23  28-Jul-2004  miquels@cistron.nl
  13. #
  14.  
  15. set -e
  16.  
  17. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  18. DESC="Network connection manager daemon"
  19. NAME="NetworkManager"
  20. DAEMON=/usr/sbin/$NAME
  21. PIDFILE=/var/run/$NAME.pid
  22. SCRIPTNAME=/etc/init.d/$NAME
  23. USER=root
  24.  
  25. # Gracefully exit if the package has been removed.
  26. test -x $DAEMON || exit 0
  27.  
  28. . /lib/lsb/init-functions
  29.  
  30. #
  31. #    Function that starts the daemon/service.
  32. #
  33. d_start() {
  34.     log_action_begin_msg "Starting NetworkManager"
  35.     if start-stop-daemon --start --quiet --pidfile $PIDFILE \
  36.         --user $USER --exec $DAEMON -- $DAEMON_OPTS; then
  37.         log_end_msg 0
  38.     else
  39.         log_end_msg 1
  40.     fi
  41. }
  42.  
  43. #
  44. #    Function that stops the daemon/service.
  45. #
  46. d_stop() {
  47.     log_action_begin_msg "Stopping NetworkManager"
  48.     if start-stop-daemon --stop --quiet --retry 5 --pidfile $PIDFILE \
  49.          --oknodo --user $USER --exec $DAEMON; then
  50.         log_end_msg 0
  51.     else
  52.         log_end_msg 1
  53.     fi
  54. }
  55.  
  56.  
  57. case "$1" in
  58.   start)
  59.     d_start
  60.     ;;
  61.   stop)
  62.     d_stop
  63.     ;;
  64.   restart|force-reload)
  65.     d_stop
  66.     sleep 1
  67.     d_start
  68.     ;;
  69.   *)
  70.     echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  71.     exit 1
  72.     ;;
  73. esac
  74.  
  75. exit 0
  76.